class Chambre < ActiveRecord::Base
  
  has_many :reservations
  has_many :clients, :through => :reservations
  
  STATUS = ["Libre", "Occupée"]
  
  def self.search(search)
    find(:all, :conditions => ["status LIKE ?", "%#{search}%"], :order => "numero")
  end
  
  validates_uniqueness_of :numero, :on => :create, :message => "must be unique"
end
